package com.hnust.dao;

import com.hnust.domain.Chapter;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ChapterDao {
	//根据章节号获取章节id
	@Select("select cha_id from chapter where chapter=#{capter} and first=#{first} and second=#{second} and third=#{third} and cou_id=#{courseId}")
	String getCapIdByCapNum(String courseId,Integer capter, Integer first, Integer second, Integer third);

	//获取章节
	@Select("select * from chapter where cou_id=#{course_id}")
	@ResultType(Chapter.class)
	List<Chapter> getChapter(String course_id);

	//根据课程ID和章节号 获取章节信息
	@Select("select * from chapter where cou_id=#{course_id} and cha_id=#{cha_id}")
	@ResultType(Chapter.class)
	Chapter getChapterInfo(String course_id,String cha_id);
}
